﻿@page
@{ Layout = "_Layout"; }

<el-card>
    <div slot="header" class="clearfix">
        <span>{{ title }}</span>
        <el-button style="float: right;padding:3px 0;" type="text" v-on:click="utils.closeLayerSelf"><i class="el-icon-close"></i></el-button>
    </div>
    <el-row :gutter="18">
        <el-col :span="6">
            <el-form :size="euiSize">
                <el-form-item label="">
                    <el-input placeholder="关键字查询"
                              v-model="filterText" prefix-icon="el-icon-search" clearable>
                        <el-button slot="append" v-on:click="loadTreeSearch" icon="el-icon-search" :loading="treeLoading">查 询</el-button>
                    </el-input>
                </el-form-item>
            </el-form>
            <el-scrollbar class="scrollbar" :style="{height: $(window).innerHeight()-170 + 'px'}">
                <div style="padding-right:15px;">
                    <el-tree class="filter-tree"
                             :data="organs"
                             :empty-text="treeLoading?'正在加载...':'暂无数据'"
                             v-on:node-click="btnTreeClick"
                             node-key="guid"
                             :props="{children: 'children', isLeaf:'isLeaf',label:'name'}"
                             accordion
                             :load="loadTree"
                             lazy
                             :filter-node-method="filterNode"
                             ref="tree">
                        <template slot-scope="{ node,data }">
                            <span style="width:100%;font-size:14px;padding:5px 0;"><span v-html="node.label"></span><span style="color:darkgray;">({{ data.userCount }}/{{ data.userAllCount }})</span></span>
                        </template>
                    </el-tree>
                </div>
            </el-scrollbar>
        </el-col>
        <el-col :span="18">
            <el-form v-on:submit.native.prevent :inline="true" :model="form" :size="euiSize">
                <el-form-item label="用户">
                    <el-input v-model="form.keyWords" placeholder="关键字" prefix-icon="el-icon-search" clearable></el-input>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" v-on:click="btnSearchClick">查询</el-button>
                    <el-button :size="euiSize" plain type="primary" icon="el-icon-plus" v-on:click="btnRangeClick">
                        安 排
                    </el-button>
                </el-form-item>
            </el-form>

            <el-table :data="list" :size="euiSize" ref="userTable" v-on:selection-change="handleSelectionChange"
                      style="width: 100%" :height="$(window).innerHeight()-220">
                <el-table-column type="selection" :selectable="selectable"
                                 width="55">
                </el-table-column>
                <el-table-column label="账号" show-overflow-tooltip>
                    <template slot-scope="scope">
                        <el-link :underline="false" type="primary" v-on:click="btnViewClick(scope.row.id)">{{scope.row.userName}}</el-link>
                    </template>
                </el-table-column>
                <el-table-column prop="displayName" show-overflow-tooltip
                                 label="姓名">
                </el-table-column>
                <el-table-column prop="organNames" show-overflow-tooltip
                                 label="组织">
                </el-table-column>
                <el-table-column label="" align="right" width="100">
                    <template slot-scope="scope">
                        <el-tag type="success" size="mini" v-if="scope.row.isRange">已安排</el-tag>
                        <el-tag type="info" size="mini" v-else>待安排</el-tag>
                    </template>
                </el-table-column>
                @await Html.PartialAsync("_PartialTableEmpty")
            </el-table>

            <div style="margin-top: 10px;">
                <el-pagination v-on:current-change="handleCurrentChange" background
                               :current-page="form.pageIndex"
                               :page-size="form.pageSize"
                               layout="total, prev, pager, next"
                               :total="total">
                </el-pagination>
            </div>
            </el-col></el-row>

</el-card>
@section Scripts{
    <script src="/sitefiles/assets/js/admin/common/usersRange.js" type="text/javascript"></script>
}